﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <script src="/js/header.js"></script>
    <title>首页</title>
    <style type="text/css">
        .noBorder {
            border: 0px;
            box-shadow: 0px 0px 0px #888888;
        }
    </style>
</head>
<body>
    <section class="container-fluid case">
        <div class="row m15_t">
            <div class="col-md-6">
                <section class="panel panel-default">
                    <header class="panel-heading clearfix">
                        <h3 class="panel-title pull-left gettext" style="font-size:16px;font-weight:bold;">当前登陆用户</h3>
                    </header>
                    <div class="panel-body">
                        <div class="data-wrap case">
                            <div class="data-tool">
                                <div class="input-group m10_t">
                                    <label class="input-group-addon t_r wd150 gettext">登陆名称：</label>
                                    <label class="form-control wd250 noBorder" id="uLoginName"></label>
                                </div>
                                <div class="input-group m10_t">
                                    <label class="input-group-addon wd150 t_r gettext">公司名称：</label>
                                    <label class="form-control wd250 noBorder" id="uCompanyName"></label>
                                </div>
                                <div class="input-group m10_t">
                                    <label class="input-group-addon t_r wd150 gettext">联络电话：</label>
                                    <label class="form-control wd250 noBorder" id="uTelephone"></label>
                                </div>
                                <div class="input-group m10_t">
                                    <label class="input-group-addon t_r wd150 gettext">联络Email：</label>
                                    <label class="form-control wd250 noBorder" id="uEmail"></label>
                                </div>
                                <div class="input-group m10_t">
                                    <label class="input-group-addon t_r wd150 gettext">谷歌验证：</label>
                                    <label class="form-control wd250 noBorder" id="uLogged"></label>
                                </div>
                                <div class="input-group m10_t">
                                    <label class="input-group-addon t_r wd150 gettext">说明：</label>
                                    <label class="form-control wd250 noBorder" id="uDescription"></label>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            </div>
            <div class="col-md-6">
                <section class="panel panel-default">
                    <header class="panel-heading clearfix">
                        <h3 class="pull-left"><span class="label label-default gettext">公告</span></h3>
                        <div class="pull-right">
                            <a id="add" class="btn btn-default btn-sm hide" data-modal="/view/announcement/edit.html" data-title="新增" data-width="470" data-height="380"><span class="glyphicon glyphicon-plus"></span> 新增</a>
                        </div>
                    </header>
                    <div class="panel-body">
                        <table class="table table-hover table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th class="t_l wd150 gettext">公告时间</th>
                                    <th class="t_l wd130 gettext">结束时间</th>
                                    <th class="t_l gettext">标题</th>
                                    <th class="wd150 gettext">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </section>
            </div>
        </div>
    </section>
    <script type="text/x-dot-template" id="templatePager">
        {{? it && it.length>0}}
        {{ for(var prop in it) { }}
        <tr>
            <td class="t_l wd150">{{=it[prop]['sdate']}}</td>
            <td class="t_l wd130">{{=it[prop]['edate']}}</td>
            <td class="t_l" title="{{=it[prop]['subject']}}"><p><span class="label label-danger">{{?  it[prop]['popups']==1}}Hot{{??}}{{?}}</span> {{=it[prop]['subject']}}</p></td>
            <td class="wd150">
                <button type="button" class="btn btn-default btn-xs" data-href="/view/announcement/view.html?id={{=it[prop]['announcementId']}}" data-title="查看 - {{=it[prop]['subject']}}" data-width="470" data-height="420" onclick="return dialogOpen(this)">
                    查看
                </button>
                {{?  it[prop]['editPermission']=='SysConfig0007'}}
                <button type="button" class="btn btn-default btn-xs" data-modal="/view/announcement/edit.html?id={{=it[prop]['announcementId']}}" data-title="编辑 - {{=it[prop]['subject']}}" data-width="470" data-height="420">
                    编辑
                </button>
                {{?}}
                {{?  it[prop]['deletePermission']=='SysConfig0008'}}
                <a class="btn btn-default btn-xs btn-danger" data-confirm='<br>确定要<span class="red">删除</span>该公告吗？' data-href="/Home/Delete?id={{=it[prop]['announcementId']}}">刪除</a>
                {{?}}
            </td>
        </tr>
        {{ } }}
        {{??}}
        <tr class="noRecord">
            <td colspan="5">暂无记录！</td>
        </tr>
        {{?}}
    </script>
    <script type="text/javascript">
        $(function () {
            
            FlashPay.Util.Ajax({
                type: "POST",
                url: "/User/GetUserInfo",
                data: null,
                dataType: "json",
                contentType: "application/json",
                success: function (res) {
                    if (res.success) {
                        $("#uLoginName").text(res.data.uLoginName == null ? "" : res.data.uLoginName);
                        $("#uCompanyName").text(res.data.companyName == null ? "" : res.data.companyName);
                        $("#uTelephone").text(res.data.uTelephone == null ? "" : res.data.uTelephone);
                        $("#uEmail").text(res.data.uEmail == null ? "" : res.data.uEmail);
                        $("#uLogged").text(res.data.uLoggedIn == 1 ? "启用" : "禁用");
                        $("#uDescription").text(res.data.uDescription == null ? "" : res.data.uDescription);
                    }
                }
            });

            Announcement();

            FlashPay.Util.Language();

        })

        function Announcement() {

            FlashPay.Util.Ajax({
                url: '/Home/GetList',
                type: 'POST',
                data: null,
                success: function (res) {
                    if (res.statusCode != null && res.statusCode == "SysConfig0007") { $("a#add").removeClass("hide"); } else { $("a#add").remove(); }
                    if (res != null && res.success) {
                        var text = doT.template($("#templatePager").text());
                        $("table tbody").html("");
                        $("table tbody").append(text(res.data));
                        var popups = $.cookie('popups');
                        if (FlashPay.Util.isNullOrEmptySpance(popups)) {
                            if (res.data != null) {
                                $.each(res.data, function (idx, obj) {
                                    if (obj.valid == 1 && obj.popups == 1) {
                                        FlashPay.UI.DialogOpen("/view/announcement/view.html?id=" + obj.announcementId, {
                                            title: "查看 - " + obj.subject,
                                            width: 452,
                                            height: 350,
                                        });
                                    }
                                });
                                $.cookie('popups', Date.parse(new Date()));
                            }
                        }
                    } else {
                        var text = doT.template($("#templatePager").text());
                        $("table tbody").append(text(null));
                    }
                }
            });

        }

        function Tip_success(word) {
            FlashPay.UI.Tip_success(word);
        }

        function dialogOpen(obj) {
            FlashPay.UI.DialogOpen($(obj).data('href'), {
                title: $(obj).data('title'),
                width: 452,
                height: 350,
            });
        }

        function doSearch() {
            Announcement();
        }
    </script>
</body>
</html>
